<div id='fl_add'>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	           <tr>
		           <td class='td_text'>商品名称：</td>
			   <td class='td_html'><input type='text' style='width:200px;height:30px;' v-model='list.fl_name'/></td>
		      </tr>
		      <tr>
		           <td class='td_text'>上级分类：</td>
			   <td class='td_html'>
                 <select style='height:30px;' v-model='list.fl_cid'>
                    <option value='0' selected>请选择</option>
                  {volist name="list" id="vo" }
                    <option value='{$vo.id}'>{$vo.fl_name}</option>
                  {/volist}
                 </select>
			   </td>
		      </tr>
		 	 <tr>
		           <td class='td_text'></td>
			   <td class='td_html'><input type='button' class='tjbtn' value='提交' {if isset($row)}@click='fl_edit({$row.id})'{else}v-on:click='fl_add()'{/if}/></td>
		      </tr>
		</table>
</div>
		<script src='/js/vue/vue.js'></script>
        <script src='/js/jquery.js'></script>
        <script src='/js/layer.js'></script>
        <script src='/js/funclayer.js'></script>
     <script>
       new Vue({
       	el:"#fl_add",
       	 data:{
       	 	list:{
       	 		fl_name:"{$row.fl_name | default=''}",
       	 		fl_cid:"{$row.fl_cid | default=0}"
       	 	}
       	 },
       	  methods:{
           fl_add(){
       	  	let self=this;
                $.ajax({
                	url:'/admin.php/home/fl_save',
                	data:self.list,
                	dataType:'json',
                	type:'post',
                	success:function(res){
                		if(res.status=='ok'){
                			_.msg('添加成功！',1,1500);
                			setTimeout(function(){
                				parent.layer.closeAll();
                				parent.location.reload();
                			},1600);
                		}else{
                			_.msg('添加失败',7,1500);
                		}
                	}
                });
             },fl_edit(id){
       	  	let self=this;
       	  	    _.msg('正在保存...',16,20000);
                $.ajax({
                	url:'/admin.php/home/fl_edit?id='+id,
                	data:self.list,
                	dataType:'json',
                	type:'post',
                	success:function(res){
                		if(res.status=='ok'){
                			_.msg('编辑成功！',1,1500);
                			setTimeout(function(){
                				parent.layer.closeAll();
                				parent.location.reload();
                			},1600);
                		}else{
                			_.msg('编辑失败！',7,1500);
                		}
                	}
                });
             }
       	  }
       });
     </script>
		<style>
   table tr{
    height: 50px;
    border:0px;
   }
  table tr .td_text{
      text-align:center;
      font-size:14px;
      width:20%;
   }
     table tr .td_html{
      width:80%;
   }
   .tjbtn {
    background: #FF5722;
    width: 100px;
    height: 30px;
    text-align: center;
    line-height: 30px;
    border-radius: 2px;
    font-family: '微软雅黑';
    color: #fff;
    border: 0;
    font-size: 15px;
    cursor: pointer;
}
</style>